// frame.cpp : Defines the entry point for the application.
//
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include "event_mapping.h"
#include "executor.h"
#include <database.h>
#include <event.h>

int CALLBACK WinMain(
  __in  HINSTANCE hInstance,
  __in  HINSTANCE hPrevInstance,
  __in  LPSTR lpCmdLine,
  __in  int nCmdShow
)
{
    char *status = "running";
    db_init();
    event_map_load();
    executor_init();
    set_thread_count( 4 );
    db_insert( "/frame/runtime/app_status", status );
    while( 0 == strcmp( status, "running" ) )
    {
        db_query( "/frame/runtime/app_status", (void**)&status );
        Sleep(100);
    }
    set_thread_count( 0 );
    executor_uninit();
    db_uninit();
    return 0;
}
